package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.BidConsultDao;
import com.chinasi.model.AgencyBasic;
import com.chinasi.model.BidAgency;
import com.chinasi.model.BidConsult;
import com.chinasi.model.ConsultBasic;
import com.chinasi.service.BidConsultService;

@Service
public class BidConsultServiceImpl implements BidConsultService {

	/**
	 * BidConsultDAO
	 */
	@Autowired
	private BidConsultDao bidConsultDao;
	
	@Override
	public Pager findRelationBid(String consultCode, int currentPage) {
		BidConsult searchBean = new BidConsult();
		searchBean.setConsultCode(consultCode);
		Pager pager = new Pager(bidConsultDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidConsultDao.findRelationBid(searchBean, pager));
		return pager;
	}
	
	@Override
	public Pager findRelationAgency(ConsultBasic consult, int currentPage) {
		Pager pager = new Pager(bidConsultDao.getRelationAgencyTotalCount(consult),currentPage);
		pager.setData(bidConsultDao.findRelationAgency(consult,pager));
		return pager;
	}

	@Override
	public Pager findRelationIntegrator(ConsultBasic consult, int currentPage) {
		Pager pager = new Pager(bidConsultDao.getRelationIntegratorTotalCount(consult),currentPage);
		pager.setData(bidConsultDao.findRelationIntegrator(consult,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsumer(ConsultBasic consult, int currentPage) {
		Pager pager = new Pager(bidConsultDao.getRelationConsumerTotalCount(consult),currentPage);
		pager.setData(bidConsultDao.findRelationConsumer(consult,pager));
		return pager;
	}

	@Override
	public Pager findRelationSupervision(ConsultBasic consult, int currentPage) {
		Pager pager = new Pager(bidConsultDao.getRelationSupervisionTotalCount(consult),currentPage);
		pager.setData(bidConsultDao.findRelationSupervision(consult,pager));
		return pager;
	}

	@Override
	public Pager findRelationExpert(ConsultBasic consult, int currentPage) {
		Pager pager = new Pager(bidConsultDao.getRelationExpertTotalCount(consult),currentPage);
		pager.setData(bidConsultDao.findRelationExpert(consult,pager));
		return pager;
	}
}
